//
// Mixins
// --------------------------------------------------

.animation(@properties) {
  -webkit-animation: @properties;
     -moz-animation: @properties;
       -o-animation: @properties;
          animation: @properties;
}

.border-radius(@radius) {
  -webkit-border-radius: @radius;
     -moz-border-radius: @radius;
          border-radius: @radius;
}

// Single side border-radius
.border-top-radius(@radius) {
  border-top-right-radius: @radius;
   border-top-left-radius: @radius;
}
.border-right-radius(@radius) {
  border-bottom-right-radius: @radius;
     border-top-right-radius: @radius;
}
.border-bottom-radius(@radius) {
  border-bottom-right-radius: @radius;
   border-bottom-left-radius: @radius;
}
.border-left-radius(@radius) {
  border-bottom-left-radius: @radius;
     border-top-left-radius: @radius;
}

.box-sizing(@boxmodel: border-box) {
  -webkit-box-sizing: @boxmodel;
     -moz-box-sizing: @boxmodel;
          box-sizing: @boxmodel;
}

.background-clip(@clip: border-box) {
  -webkit-background-clip: @clip;
     -moz-background-clip: @clip;
          background-clip: @clip;
}

.box-shadow(@properties) {
  -webkit-box-shadow: @properties;
     -moz-box-shadow: @properties;
          box-shadow: @properties;
}

.inline-block {
  display: inline-block;
  zoom: 1;
  *display: inline;
}

.opacity(@value) {
  opacity: @value / 100;
  filter: ~"alpha(opacity=@{value})";
}

// User select
// For selecting text on the page
.user-select(@select) {
  -webkit-user-select: @select;
     -moz-user-select: @select;
      -ms-user-select: @select;
       -o-user-select: @select;
          user-select: @select;
}

.placeholder-height(@height) {
  &:-moz-placeholder {
    line-height: @height;
  }
  &::-webkit-input-placeholder {
    line-height: @height;
  }
  &.placeholder {
    line-height: @height;
  }
}

.mask(@arguments) {
  -webkit-mask: @arguments;
          mask: @arguments;
}

.placeholder-color(@color) {
  &:-moz-placeholder            { color: @color; } // Firefox 4-18
  &::-moz-placeholder           { color: @color; } // Firefox 19+
  &:-ms-input-placeholder       { color: @color; } // Internet Explorer 10+
  &::-webkit-input-placeholder  { color: @color; } // Safari and Chrome
  &.placeholder       					{ color: @color; } // Fallback
}

.transition(@properties) {
  -webkit-transition: @properties;
     -moz-transition: @properties;
       -o-transition: @properties;
          transition: @properties;
  -webkit-backface-visibility: hidden;
}

.transform(@properties) {
  -webkit-transform: @properties;
     -moz-transform: @properties;
      -ms-transform: @properties;
       -o-transform: @properties;
          transform: @properties;
}

.vertical-gradient(@from, @to) {
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @from), color-stop(100%, @to));
  background: -webkit-linear-gradient(top, @from, @to);
  background:    -moz-linear-gradient(top, @from, @to);
  background:     -ms-linear-gradient(top, @from, @to);
  background:      -o-linear-gradient(top, @from, @to);
  background:   linear-gradient(to bottom, @from, @to);
}

.selection(@color) {
  &::selection {
    background: @color;
  }
  &::-moz-selection {
    background: @color;
  }
}

.clearfix {
  *zoom: 1;
  &:before,
  &:after {
    display: table;
    content: "";
  }
  &:after {
    clear: both;
  }
}

.dropdown-arrow(@color: @base, @top: 5px, @left: 15px, @size: 9px) {
  &:before {
    content: "";
    border-style: solid;
    border-width: 0 @size @size @size;
    border-color: transparent transparent @color transparent;
    height: 0;
    position: absolute;
    left: @left;
    top: @top;
    width: 0;
    // Make corners smooth
    -webkit-transform: rotate(360deg);
  }
}

.drop-ie-gradient {
  filter: unquote("progid:DXImageTransform.Microsoft.gradient(enabled = false)");
}

.swap-button-color(@color, @hover, @active) {
  background-color: @color;

  &:hover,
  &:focus,
  .btn-group:focus &.dropdown-toggle {
    background-color: @hover;
  }
  &:active,
  .btn-group.open &.dropdown-toggle,
  &.active {
    background-color: @active;
  }
}

.swap-social-button(@color) {
  background-color: @color;

  &:hover, &:focus {
    background-color: mix(@color, white, 80%);
  }
  &:active, &.active {
    background-color: mix(@color, black, 85%);
  }
}

.swap-dialog-color(@color) {
  background-color: mix(@color, white, 9%);
  border-top-color: mix(@color, white, 20%);
}

.dropdown-arrow-inverse {
  border-bottom-color: @base !important;
  border-top-color: @base !important;
}

.swap-iconbar-color(@color) {
  background-color: @color;
  > ul {
    > li {
      &.active {
        > a {
          color: mix(@color, black, 66%);
        }
      }
      > a {
        &:hover, &:focus {
          color: mix(@color, black, 66%);
        }
      }
    }
  }
  .iconbar-unread { background-color: mix(@color, black, 66%); }
}

.swap-pagination-color(@color, @hover, @active) {
  ul {
    background-color: @color;

    li {
      &.previous {
        > a {
          border-right-color: mix(@color, white, 66%);
        }
      }
      > a, > span {
        border-left-color: mix(@color, white, 66%);

        &:hover, &:focus {
          background-color: @hover;
        }
        &:active {
          background-color: @active;
        }
      }
      &.active {
        > a, > span {
          background-color: @active;
        }
      }

      &.pagination-dropdown.dropup {
        .dropdown-arrow {
          border-top-color: @color;
        }
      }
    }
  }
}

.swap-text-color(@color) {
  color: @color;
  a&:hover, a&:focus { color: mix(@color, black, 80%); }
}

// Labels
// -------------------------
.label-variant(@color, @hover-color, @text-color: @inverse) {
  background-color: @color;
  color: @text-color;
  
  &[href] {
    color: @text-color;
    
    &:hover,
    &:focus {
      color: @text-color;
      background-color: @hover-color;
    }
  }
}

// Form validation states
//
// Used in forms.less to generate the form validation CSS for warnings, errors,
// and successes.

.form-control-validation(@text-color: @base; @border-color: @lightgray; @background-color: @inverse) {
  // Color the label and help text
  .help-block,
  .control-label {
    color: @text-color;
  }
  // Set the border and box shadow on specific inputs to match
  .form-control {
  	color: @text-color;
    border-color: @border-color;
    .box-shadow(none);
    .placeholder-color(@text-color);
    
    &:focus {
      border-color: @border-color;
      .box-shadow(none);
    }
  }
  // Set validation states also for addons
  .input-group-addon {
    color: @text-color;
    border-color: @border-color;
    background-color: @background-color;
  }
}

// Form control focus state
//
// Generate a customized focus state and for any input with the specified color,
// which defaults to the `@input-focus-border` variable.
//
// We highly encourage you to not customize the default value, but instead use
// this to tweak colors on an as-needed basis. This aesthetic change is based on
// WebKit's default styles, but applicable to a wider range of browsers. Its
// usability and accessibility should be taken into account with any change.
//
// Example usage: change the default blue border and shadow to white for better
// contrast against a dark gray background.

.form-control-focus(@color: @firm) {
	.form-group.focus &,
  &:focus {
    border-color: @color;
    outline: 0;
    .box-shadow(none);
  }
}

// Form control sizing
//
// Relative text size, padding, and border-radii changes for form controls. For
// horizontal sizing, wrap controls in the predefined grid classes. `<select>`
// element gets special love because it's special, and that's a fact!

.input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius: @border-radius-large) {
  height: @input-height;
  padding: @padding-vertical @padding-horizontal;
  font-size: @font-size;
  line-height: @line-height;
  border-radius: @border-radius;

  select& {
    height: @input-height;
    line-height: @input-height;
  }

  textarea& {
    height: auto;
  }
}
